//
//  YCMeMessageViewController.m
//  YCSchool
//
//  Created by gmall on 16/5/9.
//  Copyright © 2016年 yanglinxia. All rights reserved.
//  消息

#import "YCMeMessageViewController.h"
#import "YCMeMessageCell.h"

@interface YCMeMessageViewController ()<UITableViewDelegate,UITableViewDataSource>

/** tableView */
@property (nonatomic, strong) UITableView *tableView;
/** 数据  */
@property (nonatomic, strong) NSMutableArray *dataArray;

@end

@implementation YCMeMessageViewController

#pragma mark - 生命周期

- (void)loadView
{
    UIImageView *bgImageView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    bgImageView.image = [UIImage imageNamed:@"o_topBgImg"];
    bgImageView.userInteractionEnabled = YES;
    self.view = bgImageView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor yc_colorWithUInt:0x444444 alpha:0.8];
    [self makeView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)makeView
{
    // 关闭
    UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [closeButton setTitle:@"关闭" forState:UIControlStateNormal];
    [closeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [closeButton addTarget:self action:@selector(close) forControlEvents:UIControlEventTouchUpInside];
    closeButton.titleLabel.font = [UIFont systemFontOfSize:14];
    closeButton.backgroundColor = [UIColor blackColor];
    [self.view addSubview:closeButton];
    
    // 表
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.yc_width, self.view.yc_height-50) style:UITableViewStylePlain];
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    tableView.dataSource = self;
    tableView.delegate = self;
    tableView.rowHeight = heightFromIphone6Height(110);// tableView的行高
    tableView.backgroundColor = [UIColor clearColor];//-------
    tableView.contentInset = UIEdgeInsetsMake(20, 0, 0, 0);
    self.tableView = tableView;
    [self.view addSubview:tableView];
    
    [closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.equalTo(self.view);
        make.height.equalTo(@50);
    }];
    
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self.view);
        make.bottom.equalTo(closeButton.mas_top);
    }];
    
}

#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;//self.dataArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    YCMeMessageCell *cell = [YCMeMessageCell tableViewCellWithTableView:tableView withIndexPath:indexPath];
    return cell;
}

#pragma mark - UITableViewDelegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    YCLogFunc
}



#pragma mark - 点击事件
- (void)close
{
    YCLogFunc
    [self dismissViewControllerAnimated:YES completion:nil];
}


@end
